﻿using System;
using System.ServiceModel.DomainServices.Client;
using Telerik.Windows.Controls;

namespace jSLCore.Client.Presentation.Wpf.TelerikSupport
{
    public static class RadDomainSourceHelper
    {
        public static void Reload(this RadDomainDataSource radDomainDataSource)
        {
            if(radDomainDataSource==null)throw new NullReferenceException();
            var domainContext = radDomainDataSource.DomainContext as DomainContext;
            if(domainContext!=null)
            {
                domainContext.EntityContainer.Clear();
            }
            radDomainDataSource.Load();
        }
    }
}